package ee.siimoliver.chat.server;

public class ChatMate {

	private String name;
	private String ipPort;
	private String info;
	
	public ChatMate(String name, String ipPort) {
		this.name = name;
		this.ipPort = ipPort;
		this.info = "";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIpPort() {
		return ipPort;
	}

	public void setIpPort(String ipPort) {
		this.ipPort = ipPort;
	}
	
	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((ipPort == null) ? 0 : ipPort.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ChatMate other = (ChatMate) obj;
		if (ipPort == null) {
			if (other.ipPort != null)
				return false;
		} else if (!ipPort.equals(other.ipPort))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "ChatMate [name=" + name + ", ipPort=" + ipPort + ", info="
				+ info + "]";
	}

}